<?php session_start(); 

if(!isset($_SESSION['nome']))
{
	header("Location: ../../index.php");
}

require_once '../../bibliotecas/funcoes.php';
require_once '../../base/conexao.Class.php';
$obj = new conexao(); // Instanciando a classe

// Atribuindo valores às propriedades da classe
$obj->set('db','miba');
$obj->set('host','localhost');
$obj->set('user','root');
$obj->set('pass','091190');
$obj->set('sql','select * from geracao');

$obj->conectar(); // Realiza a conexão
$obj->selecionarDB(); 

$id_geracao = $_GET['id'];
$geracao = $_POST['geracao'];
$responsavel = remover($_POST['responsavel']);
$email_responsavel = $_POST["email_responsavel"];
$tel_responsavel = $_POST["tel_responsavel"];


$result = ("UPDATE geracao SET geracao = '$geracao', responsavel = '$responsavel', email_responsavel = '$email_responsavel',
			tel_responsavel = '$tel_responsavel' WHERE id_geracao = '$id_geracao'");


$exec = mysql_query($result);

if($exec){
	echo "<script language='javascript'>alert('Alterado com sucesso!');location.href='formGeracao.php';</script>";

}else{
	echo "<script language='javascript'>alert('Erro na alteração!\\nTente mais tarde.');</script>";
}


?>